import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import MainView from '../views/MainView.vue'
import BuyTicket from '../views/ticket/BuyTicket.vue'
import PayTicket from '../views/ticket/PayTicket.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: LoginView 
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/RegisterView.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView
    },
    {
      path: '/main',
      name: 'main',
      component: MainView,
    },
    {
      path: '/buy',
      name: 'buy',
      component: BuyTicket
    },
    {
      path: '/pay',
      name: 'pay',
      component: PayTicket
    },
    {
      path: '/forget',
      name: 'forget',
      component: () => import('../views/ForgetView.vue')
    },
    {
      path: '/passenger',
      name: 'passenger',
      component: () => import('../views/passenger/PassManager.vue')
    },
    {
      path: '/orders',
      name: 'orders',
      component: () => import('../views/orders/OrderView.vue')
    },
    {
      path: '/myticket',
      name: 'myticket',
      component: () => import('../views/myticket/MyTicketView.vue')
    },
    {
      path: '/view',
      name: 'myinfo',
      component: () => import('../views/myinfo/MyInfo.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      children: [
        {
          path: 'schedule',
          name: 'schedule',
          component: () => import('../components/schedule/ScheduleView.vue')
        }
      ]
    }
  ]
})

export default router
